package com.xyzwps.server.paimon.ext

import com.xyzwps.server.paimon.error.Errors
import io.konform.validation.Validation

fun <T> Validation<T>.validOrThrow(t: T): Unit {
    val result = this.validate(t)
    if (!result.isValid) {
        val message = result.errors.first().message
        throw Errors.BAD_REQUEST.toEx(message);
    }
}